package model

import (
	"time"
)

// FlywaySchemaHistory [...]
type FlywaySchemaHistory struct {
	InstalledRank int       `gorm:"primaryKey;column:installed_rank;type:int;not null" json:"installed_rank"`
	Version       string    `gorm:"column:version;type:varchar(50)" json:"version"`
	Description   string    `gorm:"column:description;type:varchar(200);not null" json:"description"`
	Type          string    `gorm:"column:type;type:varchar(20);not null" json:"type"`
	Script        string    `gorm:"column:script;type:varchar(1000);not null" json:"script"`
	Checksum      string    `gorm:"column:checksum;type:varchar(50)" json:"checksum"`
	InstalledBy   string    `gorm:"column:installed_by;type:varchar(100);not null" json:"installed_by"`
	InstalledOn   time.Time `gorm:"column:installed_on;type:timestamp;not null;default:CURRENT_TIMESTAMP" json:"installed_on"`
	ExecutionTime int       `gorm:"column:execution_time;type:int;not null" json:"execution_time"`
	Success       bool      `gorm:"index:flyway_schema_history_s_idx;column:success;type:tinyint(1);not null" json:"success"`
}

// TableName get sql table name.获取数据库表名
func (m *FlywaySchemaHistory) TableName() string {
	return "flyway_schema_history"
}

// FlywaySchemaHistoryColumns get sql column name.获取数据库列名
var FlywaySchemaHistoryColumns = struct {
	InstalledRank string
	Version       string
	Description   string
	Type          string
	Script        string
	Checksum      string
	InstalledBy   string
	InstalledOn   string
	ExecutionTime string
	Success       string
}{
	InstalledRank: "installed_rank",
	Version:       "version",
	Description:   "description",
	Type:          "type",
	Script:        "script",
	Checksum:      "checksum",
	InstalledBy:   "installed_by",
	InstalledOn:   "installed_on",
	ExecutionTime: "execution_time",
	Success:       "success",
}
